<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
Object obj=request.getSession().getAttribute("role_resource");
if(null==obj){
	response.setStatus(1000);
	return;
}
%> 
		<script type="text/javascript">
	var p1_store = new Ext.data.JsonStore( {
		root : "data",
		totalProperty : "total",
		fields : [ "period","watch_time","watch_type", "watch_state"],
		url : "work!watchGridList.action"
	});
	
	var state_store = new Ext.data.JsonStore( {
		fields : ["id","text"],
		data:[{id:"",text:"全部"},{id:"0",text:"失败"},{id:"1",text:"成功"},{id:"2",text:"生成中"}]
	});
	var card_type=new Ext.data.JsonStore( {
		fields : ["id","text"],
		data:[{id:"",text:"全部"},{id:"0",text:"数据导入"},{id:"1",text:"XML"},{id:"2",text:"合成纸质"},
		{id:"3",text:"合成电子"},{id:"0",text:"账单分发"}]
	});	
	
	var sel = function(){
		p1_store.baseParams = p1_store.baseParams || {};
		p1_store.baseParams["watchState.period"] = Ext.getCmp("a").getValue();
		p1_store.baseParams["watchState.watch_type"] = Ext.getCmp("b").getValue();
		p1_store.baseParams["watchState.watch_state"] = Ext.getCmp("c").getValue();
		p1_store.load({params:{start:0,limit:limit}});
	};
	var watch_pel = new Ext.Panel( {
		id: "panel",
		border : false, 
		layout: "card",
		activeItem:0,
		items:[{
			id:"p1",
			xtype:"grid",
			store:p1_store,
			border : false, 
			autoExpandColumn: "watch_state",
			autoExpandMin: 200,
			headersDisabled: true,
			columns:[
				new Ext.grid.RowNumberer( {header : "序号",width : 35}), 
			    {dataIndex : "period",header : "期别",	width: 200, menuDisabled: true},
			    {dataIndex : "watch_type",header : "类别",	width: 200, menuDisabled: true,
			       renderer:function(input){
	 				  if(""==input)return input;
	          		  var res2=card_type.getById(input);
					  return res2.data.text;
	           	   }
			    },
			    {dataIndex : "watch_time",header : "开始时间",width:200, menuDisabled: true},    
			    {dataIndex :"watch_state",header:"状态", id:"watch_state", menuDisabled: true,
			       renderer:function(input){
	 				  if(""==input)return input;
	          		  var res2=state_store.getById(input);
					  return res2.data.text;
	           	   }
			    }
			],
			bbar: new Ext.ux.PagingToolbar({
            	pageSize: limit,
            	store: p1_store
        	}),
			tbar:["&nbsp&nbsp期别:",
			  {
				id: "a",
				xtype:"datefield",
				format:"Y-m-d",
				editable :false,
				listeners: {
					"select": sel
				}
			},"&nbsp&nbsp类别:",
			 {
				id: "b",
				xtype: "billCombox",
				store: card_type,
				width:120,
				value:"",
				listeners: {
					"select": sel
				}
			},"&nbsp&nbsp状态:",
			{
				id: "c",
				xtype: "billCombox",
				store: state_store,
				width:120,
				value:"",
				listeners: {
					"select": sel
				}
			}]
		}]
	});
	p1_store.load({params:{start:0,limit:limit}});
	
		
	var CenterPanel=Ext.getCmp("CenterPanel");
	CenterPanel.removeAll();
	CenterPanel.add(watch_pel);
	CenterPanel.doLayout();
</script>